package com.android.widget;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        BannerPager bannerPager = findViewById(R.id.banner);

        List<Integer> list = new ArrayList<>();
        list.add(R.mipmap.ic_banner_1);
        list.add(R.mipmap.ic_banner_2);
        list.add(R.mipmap.ic_banner_3);
        list.add(R.mipmap.ic_banner_4);
        list.add(R.mipmap.ic_banner_5);
        bannerPager.setAdapter(new IndexBannderAdapter(this, list));

        bannerPager.setOnPageClickListener(new BannerPager.OnPageClickListener() {
            @Override
            public void onPageClick(int position) {

            }
        });
    }


    private class IndexBannderAdapter extends BannerAdapter {

        public IndexBannderAdapter(Context context, List list) {
            super(context, list);
        }

        @Override
        public int getCount() {
            return super.getCount();
        }
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }



}
